<?php

namespace App\Http\Controllers\PC\Download;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use App\Http\Service\Statistic\StatisticService;
use Session;
use Config;


class IndexController extends Controller
{
    protected  $index = 'PC.Download.index';
    private $statistic;
    private $params = [];

    public function __construct(StatisticService $statistic)
    {
        $this->statistic = new StatisticService();
    }

    public function index()
    {
        $title = '下载';
        return view($this->index)->with('title',$title);
    }

    //  推广下载
    public function ExtensionDownload(Request $request)
    {
        if(Session::get(Config::get('custom.setting.MEMBER_QUERY')))
        {
            $this->params['url'] = Session::get(Config::get('custom.setting.MEMBER_QUERY'));
            $this->params['code'] = Session::get(Config::get('custom.setting.MEMBER_UNQUIE_CODE'));
            $this->params['action'] = 'download';    // 下载
            $this->params['terminal_id'] = 2;  //  PC端
            $this->params['status'] = '1';  //  状态
            $this->params['ip'] = $request->getClientIp();  //  客户端IP
            $this->statistic->Statictis($this->params);
        }
    }


}
